#include<stdio.h>
#include<stdlib.h>
#include<string.h>

// @ 函数指针作为参数

// 提供一个打印函数，可以打印任意类型的数据
void printText( void * data, void(*myPrint)(void*) ){
    myPrint(data);
}

//
void myPrintInt(void * data){
    int * num = data;
    printf("%d\n", *num);
}

void test1(){
    int a = 10;

    printText(&a, myPrintInt);
}

struct Person{
    char name[64];
    int age;
};

void myPrintStruct(void * data){
    struct Person * p = data;
    printf("%s,%d",p->name,p->age);
}

void test2(){
    struct Person p ={"tom",18};
    printText(&p,myPrintStruct);
}


void main(){
    test2();
}